home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Tools & Goodies / AppMaker demo / Using AppMaker with ODF < prev   
Encoding:
Text File  |  1996-08-16  |  15.3 KB  |  263 lines  |  [TEXT/ttxt]

  1. OpenDoc
  2. Development
  3. Framework
  4.                                                                                                                                                                                      
  5. Using AppMaker with ODF
  6. ODF Release 1                                                                                                                                                                             
  7.  
  8.  
  9. Introduction
  10.  
  11. This folder contains a demo version of AppMaker 2.0 beta 4 (*) from Bowers Development.   AppMaker is the first 3rd party visual editor to support ODF by generating view resource files (Views.fr).  Demo AppMaker  is a fully functional version except that it can't save files.  However you will still be able to use the generated Views.fr file in your ODF part.
  12.  
  13. (*) If you downloaded ODF from the Internet the demo of AppMaker is not included, you must get it from Bowers Development's home page (http://members.aol.com/bowersdev) and follow the Installation instructions below.
  14.  
  15. Advantages
  16. • Visual editing of views.
  17. • Resources are generated in a readable source format that can be edited later.
  18. • AppMaker templates can be customized by advanced users.
  19.  
  20. Current Limitations
  21. • The AppMaker ODF language template provided here generates only view resources, you must use PartMaker to generate source and project files.  Since AppMaker is highly customizable it will be able to generate much more in the future.
  22. • Support for CodeWarrior only.
  23. • Requires manual editing of some PartMaker-generated files.
  24. • May require manual editing of the resource file generated.  (Once modified Views.fr cannot be regenerated.)
  25. • No generation of menu resources.
  26. • Doesn't support subclassing yet.
  27. • See also the Known Problems section at the end of this document.
  28.  
  29. Important: AppMaker's support of ODF is a work in progress.  Please check ODF or AppMaker web pages for the latest information and new versions of the ODF template:
  30. -> http://www.devtools.apple.com/odf/
  31. -> http://members.aol.com/bowersdev
  32.  
  33. Installation
  34.  
  35. Installation from the OpenDoc DR5 CD
  36.  
  37. Copy the AppMaker demo folder to your hard disk.  You can remove the non ODF examples in order to save disk space.
  38.  
  39. We recommend that you move the folder AMLibrary found inside :Libraries:Metrowerks:ODF: into either your :ODFDev:ODF:Framewrk:  folder or your CodeWarrior's Mac OS Support folder.  This way you won't need to update your project access paths.
  40.  
  41. Installation from the Internet
  42.  
  43. If you downloaded ODF from the Internet go to Bowers Development's home page (http://members.aol.com/bowersdev) and download the latest demo version of AppMaker and ODF files.
  44.  
  45. Installation from the AppMaker CD #4
  46.  
  47. If you already have AppMaker CD #4 (containing the full 2.0 beta 4 version) you should still install the demo version first as explained above (either from the OpenDoc DR5 CD or from the Internet) because AppMaker CD #4 contains older versions of ODF files and its Stationery file has changed.  Then you can copy the full application AppMakerPPC or AppMaker68K inside your AppMaker folder.
  48.  
  49.  
  50. User Guide
  51.  
  52. AppMaker's support of ODF is still in the development stage, we recommend that you follow these step-by-step instructions carefully when creating a new ODF part.
  53.  
  54. The  steps below may look like a lot of work but most of them need to be done only once.  After the first pass you will be able to keep editing your part's views in AppMaker without making any special changes to source files (other than adding functionality of course)
  55.  
  56. 1) First use PartMaker to create a new part from one of our templates.  
  57.  
  58. In this document we'll use the Container• template to create a part that supports scrolling and embedding and we assume that your new part is called MyPart.
  59.  
  60. -> After launching PartMaker and choosing a part name and company name select the ODFDev folder as the location of your new part's folder, so that you don't have to edit your project's access paths.
  61.  
  62. -> Once PartMaker is done generating files, remember to update the 'nmap' resources and signature right away as explained in the PartMaker Read Me document.
  63.  
  64. -> You should also make a copy of Views.fr before AppMaker modifies it.
  65.  
  66. 2) Add AppMaker's AM Library files to your project
  67.  
  68. -> Locate the folder AMLibrary and add the .cpp files to your project. 
  69.  
  70. Note: if you followed the Installation instructions above you should have a copy of AMLibrary in your CodeWarrior's MacOS Support  folder or the :ODFDev:ODF:Framewrk: folder.
  71.  
  72. The AMLibrary files contain custom resource types and source code such as a radio group view and a picture view which are not part of ODF.  This code won't be linked with your part if you don't use these resource types.
  73.  
  74. 3) Launch AppMaker 2.0 beta 4 and create a new AppMaker document.
  75.  
  76. -> Click "New" in the file dialog.
  77.  
  78. This opens an outliner window "Untitled".
  79.  
  80. -> If you are using a full AppMaker version save the file in your part's folder (the demo version cannot save files).
  81.  
  82. This is necessary in order to generate Views.fr later in the Sources subfolder.  Name the AppMaker file "MyPart.AppMaker" for instance, not "MyPart" alone which will also be the name of the part library.  The name you choose will replace "untitled" in the outliner window.
  83.  
  84. -> Change the application name to your part's name.
  85.  
  86. In the outliner window expand the Application field and double-click on "YourApp" to change the name.  This name is used to generate a .rsrc file containing Mac specific resources such as PICT  and MENU.
  87.  
  88. 4) Edit one or more windows
  89.  
  90. Each AppMaker window corresponds to an ODF frame object, i.e. generates an ODF FW_RFrameLayout resource.
  91.  
  92. -> Change the default "MainWindow" name to a name representing your frame. 
  93.  
  94. This is important to generate a meaningful id for the FW_RFrameLayout resource.  The same id will be used when creating the frame in the method YourPart::NewFrame as explained in step (6) below. 
  95.  
  96. -> To create an ODF scrolling content view use the Rectangle tool (simple square icon in the Tools palette) and put 2 scroll bars around it.
  97.  
  98. AppMaker doesn't have a Scroller tool, but adding scroll bars will automatically generate an ODF Scroller resource.  You should name the rectangle view "Content" or "ContentView" to make the generated code clearer.  
  99.  
  100. -> Add other views in the rectangle area with the Tools palette. 
  101.  
  102. Note: The following views are not supported in ODF 1 and won't generate any resources: lines, icons, layout, tab panels, palettes, and progress bar.
  103.  
  104. The name of each view (except scroll bars) is used to generate the resource id.
  105. Stickiness attributes are supported for all views except scroll bars and rectangle.
  106.  
  107. -> Be sure to use the RadioGroup view instead of adding individual radio buttons. 
  108.  
  109. -> To create a frame without scrolling content simply add views directly in the window without using the rectangle tool.
  110.  
  111. This will create an ODF frame that is its own content view.
  112.  
  113. -> You can add more windows, each with a different name. 
  114.  
  115. Be sure to use different names for their views too because all ids are generated in the same ViewIds.k file.  Similar names will result in constant redefinition errors.
  116.  
  117. 5) Use AppMaker's Generate command  to generate the ODF resource files.
  118.  
  119. Before using Generate be sure to close the files Views.fr, ViewIds.k and yourApp.rsrc in case you were editing them.
  120.  
  121. -> When you use Generate for the first time pick "ODF" as the language.
  122.  
  123. -> AppMaker generates new Views.fr, ViewIds.k and a .rsrc files in the Sources subfolder.
  124.  
  125. Important: 
  126. • If you are using Demo AppMaker (or if you hadn't saved the document in your part's folder) the Sources folder is created in the AppMaker folder itself:  you must copy the files into your part's Sources folder (you can erase the Views.fr that was generated earlier by PartMaker).
  127. • Before using Generate  save earlier versions of Views.fr files if you need them, in particular if you had made manual changes that will need to be pasted back in the new version.
  128.  
  129. The resource file YourApp.rsrc  contains Mac specific resources if you used a Pict view or a popup menu control (right now the file is still generated when it is empty).
  130.  
  131. -> After generating resources for the first time add the file YourApp.rsrc to your project.  
  132.  
  133. Views.fr is already in the project that was generated by PartMaker.
  134.  
  135. -> Views.fr  needs to be edited manually in the following cases:
  136. • to change a control receiver, message or value attribute.
  137. • to change an edit view or list box attribute hard-coded by AppMaker.
  138.  
  139. Unfortunately these manual changes are not preserved if you regenerate Views.fr.
  140.  
  141. 6) Update your source files with AppMaker-generated view ids 
  142.  
  143. It is necessary to update manually some source files using the resource ids.  However you need to do this only once, after creating a frame for the first time.
  144.  
  145. -> In Defines.k add   #include "ViewIds.k"
  146.  
  147. You should also comment out any existing view ids that were listed in Defines.k.  They are now generated automatically in ViewIds.k.
  148.  
  149. -> For a scrolling content view, set its extent X and Y values in Defines.k.
  150.  
  151. The content view's extent, i.e. the size of its scrolling area, cannot be defined in AppMaker yet, it is generated as {kNameExtentX, kNameExtentY} in Views.fr.  You can define these constants in Defines.k.  For instance for a part based on Container the values are simply the fixed equivalent of the drawing size constants that are already defined:
  152.  
  153.   #define kDrawingSizeX                   1024 * 5
  154.   #define kDrawingSizeY                         1024 * 5
  155.  
  156.   #define kContentExtentX                    65536 * kDrawingSizeX
  157.   #define kContentExtentY                    65536 * kDrawingSizeY
  158.  
  159. ->  Use the correct frame resource id in YourPart::NewFrame() in Part.cpp. 
  160.  
  161. The frame resource id is generated in ViewIds.k and in Views.fr:
  162.  
  163.     resource FW_RFrameLayout(kMyFrameResId)
  164.  
  165. This id must be the last argument of the frame's constructor in YourPart::NewFrame() otherwise you will get the runtime assertion "Cannot load view or frame resource". 
  166.  
  167. -> In View.cpp use the correct content view id in the content view constructor . 
  168.  
  169. -> In View.cpp change the content view class type to 'CntV' as in:
  170.  
  171. const FW_ClassTypeConstant LMyPartView = FW_TYPE_CONSTANT('C','n','t','V');
  172.  
  173. Your content view had the class type from the PartMaker template.  AppMaker generates a content view resource of type RContentView (defined in AMViews.fr) so you must use the corresponding class type to load this resource.
  174.  
  175. 7) Other changes required when adding views to an ODF part
  176.  
  177. This section is not specific to AppMaker, you must make the following changes whenever you add views to an ODF part:
  178.  
  179. -> Add the macro FW_DO_NOT_DEAD_STRIP(<viewclass>) in your Part::Initialize method.
  180.  
  181. If you were using all kinds of views you would typically add these lines:
  182.     FW_DO_NOT_DEAD_STRIP(FW_CButton);
  183.     FW_DO_NOT_DEAD_STRIP(FW_CEditView);
  184.     FW_DO_NOT_DEAD_STRIP(FW_CListBox);
  185.     FW_DO_NOT_DEAD_STRIP(FW_CStaticText);
  186.     FW_DO_NOT_DEAD_STRIP(FW_CScrollBar);
  187.     FW_DO_NOT_DEAD_STRIP(FW_CGroupBox);
  188.     FW_DO_NOT_DEAD_STRIP(FW_CRadioCluster);
  189.     FW_DO_NOT_DEAD_STRIP(FW_CScroller);
  190.     FW_DO_NOT_DEAD_STRIP(CRadioGroup);
  191.     FW_DO_NOT_DEAD_STRIP(CPictView);
  192.  
  193. The macro is required to prevent the linker from dead-stripping classes that were defined in resources.  Once you start adding code using some of these classes the macro is no longer necessary because at least one method of the class is referenced.
  194.  
  195. -> After adding buttons make sure that your frame class derives from FW_MReceiver and that you implement a HandleNotification method.
  196.  
  197. Adding a button view automatically makes the frame the receiver of this button's messages.  If you forget to make your frame class derive from FW_MReceiver you will get the runtime assertion "Your view or frame is not a receiver or you forgot the RTTI macro".  
  198.  
  199. You must also add FW_MReceiver to the FW_DEFINE_CLASS macro in frame.cpp, as in:
  200.  
  201. FW_DEFINE_CLASS_M2(CMyFrame, FW_CEmbeddingFrame, FW_MReceiver)
  202.  
  203. Finally you must implement FW_MReceiver's pure virtual function HandleNotification otherwise you will get a compile error.  (See ODF Form for sample code using controls and notifications.)
  204.  
  205.  
  206. Known Problems
  207.  
  208. AppMaker 2.0 beta4 ... is a beta version.
  209.  
  210. Please see Bowers Development's release notes and web page for the list of known bugs specific to AppMaker.   The following is a partial list of known issues:
  211.  
  212. • Be aware that you must always switch back to the Arrow tool in the palette after creating 1 or more views.  Otherwise every click with the Cross cursor keeps creating new views. 
  213. • The Properties window seems to have problems.  It's better to use the Coordinates floating window to adjust view coordinates manually.
  214. • Generate gives a runtime assertion if one of the generated files was left open (just close the files and do Generate again)
  215. • The AppMaker Form example has a large background Pict view.  Moving other sibling views will attach them to the Pict view as their parent.
  216.  
  217. Not all ODF resource fields can be edited through AppMaker
  218.  
  219. In this early release AppMaker leaves several fields hard-coded when it generates Views.fr.  In particular the control message, control receiver and control value fields are hard coded.  You must change them manually in Views.fr if the default values are not what you need.
  220.  
  221. Not all AppMaker views and properties are supported by ODF
  222.  
  223. AppMaker is a generic programming tool.  Some views and properties either don't apply to ODF or are not supported yet (lines, icon, layout, tab panels, palettes, progress bar).
  224.  
  225. Custom ODF views cannot be added
  226.  
  227. A future version of AppMaker will support subclassing. 
  228.  
  229.  
  230. Questions and Answers
  231.  
  232. Where do I get more information and trouble-shooting tips if I have a problem?
  233.  
  234. First check the ODF web page for the latest update of AppMaker's ODF template.  If you are still having problems you can send mail to the ODF-Interest list with your ODF/AppMaker questions. 
  235.  
  236. Note: AppMaker is not an Apple product,  Apple Technical Support cannot answer questions regarding this product.  However the engineers monitoring the ODF-Interest list will do their best to help you use AppMaker with ODF.  AppMaker specific questions should be directed to Bowers Development, bowersdev@aol.com.
  237.  
  238. How do I create menus?
  239.  
  240. The current ODF language template doesn't let AppMaker generate menu resources.  You must edit the file Menus.fr manually.
  241.  
  242. How do I create popup menus?
  243.  
  244. Add a popup menu view in AppMaker ("Pop" icon) and simply type the item strings in the Values List area of the Info window.  This will create a Mac MENU resource containing these strings in YourApp.rsrc and an ODF Popup menu resource in Views.fr with a reference to this MENU resource (id starts at 1000).
  245.  
  246. How do I create a dialog frame?
  247.  
  248. Creating a dialog frame is the same process as creating a normal frame.  In ODF both use the same FW_RFrameLayout resource type, so it doesn't matter if you use a normal window or a dialog in AppMaker (remember to remove the grow box).
  249.  
  250. After adding default and cancel buttons you must edit Views.fr to change the buttons message fields to FW_kDefaultButtonMsg and FW_kCancelButtonMsg.
  251.  
  252. See the engineering note Using Dialogs for more information on implementing ODF dialogs.
  253.  
  254. How do I change the About box?
  255.  
  256. If you want to keep the default ODF About box and just change the text you can simply edit the string resources in PartInfo.r. 
  257.  
  258. If you want to replace the ODF About box with your own window you can create a dialog frame with AppMaker.
  259.  
  260.  
  261. © 1993 - 1996 Apple Computer, Inc. All rights reserved.
  262. Apple, The Apple Logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  263. OpenDoc is a trademark of Apple Computer, Inc. registered in the United States and other countries.